package com.yueka.mapper;

import com.yueka.pojo.course.CourseRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface CourseRecordMapper {
    void insert(CourseRecord recordRecord);
    void update(CourseRecord recordRecord);
    @Delete("delete from course_record where course_id = #{courseId}")
    void delete(Integer courseId);

    List<CourseRecord> getList(String schoolTime, String status);

    List<CourseRecord> getByStudentId(Integer studentId, LocalDateTime start, LocalDateTime end, String crType);

    List<CourseRecord> getByTeacherId(Integer teacherId, LocalDateTime start, LocalDateTime end);
    @Delete("delete from course_record where id = #{id}")
    void deleteById(Integer id);

    @Select("select cr.id as id, cr_type, teacher_id, cr.status as status, content, job, school_time, remark, course_id, teacher_name from course_record cr, teacher t where cr.teacher_id = t.id and course_id = #{courseId}")
    List<CourseRecord> selectByCourseId(Integer courseId);
}
